﻿using Max.PH4.Shoppgin.Admin.DataAccess;
using Max.PH4.Shoppgin.Admin.Domain;
using Max.PH4.Shoppgin.Admin.IRespository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Max.PH4.Shoppgin.Admin.Respository
{
    public class LogisticDetailRespository : ILogisticDetailRespository
    {
        MyDbContext _context;

        public LogisticDetailRespository(MyDbContext context)
        {
            _context = context;
        }

        public void Delete(LogisticDetailEntity entity)
        {
            _context.Remove(entity);
        }

        public void Delete(object id)
        {
            var m = _context.LogisticDetails.Find(id);
            if (m != null)
                _context.LogisticDetails.Remove(m);
        }

        public void Insert(LogisticDetailEntity entity)
        {
            _context.LogisticDetails.Add(entity);
        }

        public void Insert(List<LogisticDetailEntity> entities)
        {
            _context.LogisticDetails.AddRange(entities);
        }

        public IQueryable<LogisticDetailEntity> Query()
        {
            return _context.LogisticDetails;
        }

        public void Update(LogisticDetailEntity entity)
        {
            _context.LogisticDetails.Update(entity);
        }

        public void Update(List<LogisticDetailEntity> entities)
        {
            _context.LogisticDetails.UpdateRange(entities);
        }
    }

}
